package com.cskaoyan.controller;

import com.cskaoyan.service.UserService;
import com.cskaoyan.vo.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {

    @Autowired
    UserService userService;

    @RequestMapping("admin/user/list")
    public BaseRespVo list(Integer page, Integer limit,
                           String sort, String order,
                           String username,
                           String mobile) {
        UserVo userVo = userService.queryList(page, limit, sort, order, username, mobile);
        return BaseRespVo.ok(userVo);
    }


    @RequestMapping("admin/address/list")
    public BaseRespVo address(Integer page, Integer limit,
                              String sort, String order,
                              String name,
                              Integer userId) {
        AddressVO addressVO = userService.queryAddress(page, limit, sort, order, name, userId);
        return BaseRespVo.ok(addressVO);
    }

    @RequestMapping("admin/collect/list")
    public BaseRespVo collect(Integer page, Integer limit,
                              String sort, String order,
                              Integer userId,
                              Integer valueId) {

        CollectVO collectVO = userService.queryCollect(page, limit, sort, order, userId, valueId);
        return BaseRespVo.ok(collectVO);

    }

    @RequestMapping("admin/footprint/list")
    public BaseRespVo footprint(Integer page, Integer limit,
                                String sort, String order,
                                Integer userId,
                                Integer goodsId) {
        FootprintVO footprintVO = userService.queryFootprint(page, limit, sort, order, userId, goodsId);
        return BaseRespVo.ok(footprintVO);
    }

    @RequestMapping("admin/history/list")
    public BaseRespVo history(Integer page, Integer limit,
                              String sort, String order,
                              Integer userId,
                              String keyword) {
        HistoryVO historyVO = userService.queryHistory(page, limit, sort, order, keyword, userId);
        return BaseRespVo.ok(historyVO);
    }
    @RequestMapping("admin/feedback/list")

    public BaseRespVo feedback(Integer page, Integer limit, String username, String sort,
                               String order, Integer id
                               ){

      FeedbackVO feedbackVO=  userService.feedback(page,limit,username,sort,order,id);

      return BaseRespVo.ok(feedbackVO);

    }


}
